%macro media_var_n (DATA=, var= , id= ,
			VECMEDIAS=medias , NVALIDOS=validos, COVAR=covar );
                                    
	PROC MEANS DATA=&data NOPRINT; 
		VAR 	&var;
		OUTPUT OUT=&VECMEDIAS MEAN=; 
		OUTPUT OUT=&NVALIDOS    N=; 
		BY &id;
	RUN;

	PROC CORR data=&DATA out=chicha cov noprint; 
		VAR 	&var;
		BY &id;		
	RUN;

	DATA &COVAR; set chicha; where _TYPE_='COV';RUN;
    PROC DATASETS library=work ; DELETE CHICHA;RUN;

%MEND MEDIA_VAR_N ;
